/*
 * general.cpp
 *
 *  Created on: Oct 18, 2012
 *      Author: David Kadlecek, Ales Fiser
 */

#ifndef GENERAL_H_
#define GENERAL_H_

#include <iostream>
#include <string>
#include <fstream>
#include <string>
#include <sstream>
#include <stdint.h>
#include <time.h>
#include <stdlib.h>
#include "mpi.h"

#define CHECK_MSG_AMOUNT  100

#define MSG_WORK_REQUEST 1000
#define MSG_WORK_SENT    1001
#define MSG_WORK_NOWORK  1002
#define MSG_TOKEN        1003
#define MSG_FINISH       1004
#define MSG_FINAL_RESULT 1005
#define MSG_MAX_DEPTH 	 1006

using namespace std;

const string fileInput = "testdata/100_50";

/*--------------start measurements config -------------*/

const bool runTestCode = false;
const bool logBasicDebugCore = false;
const bool logIsNotConnected = false;
const bool logTask = false;
const bool logTaskStartNodeInfo = false;
const bool logSavingMax = false;
const bool logMainStates = false;

const bool logSplit = false;
const bool logReceiveTaskData = false;


const bool logSendToken = false;
const bool logSendTokenStart = false;
const bool logSendFinish = false;
const bool logSendTokenRecieve = false;
const bool logSendTokenRecieveStart = false;
const bool logSplitPrep = false;
const bool logSendTask = false;
const bool logReceiveTask = false;
const bool logSendTaskRequest = false;
const bool logSendNoWork = false;
const bool logReceiveNoWork = false;
const bool logResultsFromAllJobs = true;
const bool logCalculatedNodesDegrees= false;
const bool logReceiveMax = false;
const bool logMergePart = false;
const bool logSendMyMax = false;
const bool logFinalize = false;
/*------------end measurements config--------------*/

/*------------start observation config-----------------*/
//const bool runTestCode = false;
//const bool logBasicDebugCore = false;
//const bool logIsNotConnected = false;
//const bool logTask = false;
//const bool logTaskStartNodeInfo = false;
//const bool logSavingMax = false;
//const bool logMainStates = false;
//
//const bool logSplit = false;
//const bool logReceiveTaskData = false;
//
//const bool logSendToken = false;
//const bool logSendTokenStart = false;
//const bool logSendFinish = false;
//const bool logSendTokenRecieve = false;
//const bool logSendTokenRecieveStart = false;
//const bool logSplitPrep = false;
//const bool logSendTask = false;
//const bool logReceiveTask = false;
//const bool logSendTaskRequest = false;
//const bool logSendNoWork = false;
//const bool logReceiveNoWork = false;
//const bool logResultsFromAllJobs = true;
//const bool logCalculatedNodesDegrees= false;
//const bool logReceiveMax = true;
//const bool logMergePart = true;
//const bool logSendMyMax = true;
//const bool logFinalize = false;

/*---------------------end observation config--------------*/

const char EMPTY = -1;
const float r = 0.001;

const int taskTreshold = 10;

void logPrintMessage(string message);
void logPrintMessageWithActualState(string message, int* res, int numOfNodesInInput);
void logPrintResult(int16_t* res, int numOfNodesInInput);

#endif /* GENERAL_H_ */

